package _aspect;

import _spring_test._aop.AopTest;
import org.aspectj.weaver.tools.PointcutExpression;
import org.aspectj.weaver.tools.ShadowMatch;

import java.lang.reflect.Method;

/**
 * @Author: huangya
 * @Date: 2020/5/13
 * @Description:
 */
public class ShadowMatchTest {

    public static void main(String[] args) throws NoSuchMethodException {
        Method testMethod = AopTest.class.getMethod("test");

        MyAspectJExpressionPointcut myAspectJExpressionPointcut = new MyAspectJExpressionPointcut();
        myAspectJExpressionPointcut.setExpression("execution(* _spring_test._aop.*.*(..))");
        PointcutExpression pointcutExpression = myAspectJExpressionPointcut.buildPointcutExpression(ClassLoader.getSystemClassLoader());
        ShadowMatch shadowMatch = pointcutExpression.matchesMethodExecution(testMethod);
        System.out.println(shadowMatch.alwaysMatches());
    }
}
